agents.anac.y2011.Nice_Tit_for_Tat
Class BilateralAgent

java.lang.Object
  extended by negotiator.Agent
      extended by agents.anac.y2011.Nice_Tit_for_Tat.BilateralAgent
All Implemented Interfaces:
BidHistoryKeeper
Direct Known Subclasses:
NiceTitForTat, TimeDependentAgent

public abstract class BilateralAgent
extends Agent
implements BidHistoryKeeper

Author:
Tim Baarslag Agent skeleton for a bilateral agent. It contains service functions to have access to the bidding history.

Field Summary
protected  Domain domain
           
protected  BidHistory myHistory
           
protected  BidHistory opponentHistory
           
 
Fields inherited from class negotiator.Agent
fNegotiation, parametervalues, sessionNr, sessionsTotal, startTime, strategyParameters, timeline, totalTime, utilitySpace
 
Constructor Summary
BilateralAgent()
           
 
Method Summary
 Action chooseAction()
          this function is called after ReceiveMessage, with an Offer-action.
abstract  Bid chooseCounterBid()
          The opponent has already made a bid.
abstract  Bid chooseFirstCounterBid()
          Use this method to make the first counter-bid.
abstract  Bid chooseOpeningBid()
          Use this method to make an opening bid.
 Bid getMyLastBid()
           
 Bid getMySecondLastBid()
           
 BidHistory getOpponentHistory()
           
 Bid getOpponentLastBid()
           
 int getRound()
          Returns the current round number, starting at 0.
protected  double getUndiscountedUtility(Bid bid)
           
static java.lang.String getVersion()
           
 void init()
          This method is called by the protocol every time before starting a new session after the internalInit method is called.
abstract  boolean isAcceptable(Bid plannedBid)
          At some point, one of the parties has to accept an offer to end the negotiation.
protected static void log(java.lang.String s)
           
protected  Action makeAcceptAction()
          By default, if an offer is deemed acceptable, we send accept.
 void ReceiveMessage(Action opponentAction)
          informs you which action the opponent did
static double round2(double x)
          Rounds to two decimals
 
Methods inherited from class negotiator.Agent
endSession, getAgentID, getName, getParameterValues, getSessionNumber, getSessionsTotal, getStrategyParameters, getUniqueIdentifier, getUtility, internalInit, isUIAgent, loadSessionData, parseStrategyParameters, restartDataObjectsFolder, saveSessionData, setAgentID, setName, sleep
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

domain

protected Domain domain

myHistory

protected BidHistory myHistory

opponentHistory

protected BidHistory opponentHistory
Constructor Detail

BilateralAgent

public BilateralAgent()
Method Detail

init

public void init()
Description copied from class: Agent
This method is called by the protocol every time before starting a new session after the internalInit method is called. User can override this method.

Overrides:
init in class Agent

getVersion

public static java.lang.String getVersion()

ReceiveMessage

public void ReceiveMessage(Action opponentAction)
Description copied from class: Agent
informs you which action the opponent did

Overrides:
ReceiveMessage in class Agent

getUndiscountedUtility

protected double getUndiscountedUtility(Bid bid)

chooseAction

public Action chooseAction()
Description copied from class: Agent
this function is called after ReceiveMessage, with an Offer-action.

Specified by:
chooseAction in class Agent
Parameters:
remember: - remember the action or not.
Returns:
(should return) the bid-action the agent wants to make.

makeAcceptAction

protected Action makeAcceptAction()
By default, if an offer is deemed acceptable, we send accept. Overwrite this method to change this behaviour.


isAcceptable

public abstract boolean isAcceptable(Bid plannedBid)
At some point, one of the parties has to accept an offer to end the negotiation. Use this method to decide whether to accept the last offer by the opponent.

Parameters:
plannedBid -

chooseCounterBid

public abstract Bid chooseCounterBid()
The opponent has already made a bid. Use this method to make an counter bid.


chooseOpeningBid

public abstract Bid chooseOpeningBid()
Use this method to make an opening bid.


chooseFirstCounterBid

public abstract Bid chooseFirstCounterBid()
Use this method to make the first counter-bid.


getMyLastBid

public Bid getMyLastBid()
Specified by:
getMyLastBid in interface BidHistoryKeeper

getMySecondLastBid

public Bid getMySecondLastBid()
Specified by:
getMySecondLastBid in interface BidHistoryKeeper

getOpponentHistory

public BidHistory getOpponentHistory()
Specified by:
getOpponentHistory in interface BidHistoryKeeper

getOpponentLastBid

public Bid getOpponentLastBid()
Specified by:
getOpponentLastBid in interface BidHistoryKeeper

getRound

public int getRound()
Returns the current round number, starting at 0. This is equal to the total number of placed bids.


log

protected static void log(java.lang.String s)

round2

public static double round2(double x)
Rounds to two decimals